## 3 Extended Finite Element Method: Review
### Domain-Specific Language Extensions  
In the domain-specific language used by the form compiler FFC, we need to include discontinuous finite element function spaces, various operators at discontinuity surfaces and integration over discontinuity surfaces. Inspired by the decomposition of the displacement field in (5), we define \"continuous\" and \"discontinuous\" function spaces which will correspond to \(\bar{u}_{h}\) and \(\hat{u}_{h}\), respectively, and a mixed space is then defined as the sum of the two,  
elem_cont = FiniteElement(type, shape, order)  elem_discont = DiscontinuousFiniteElement(type, shape, order)  element = elem_cont + element_discont where type is the finite element type e.g. \"Lagrange\", \"discontinuous Lagrange\" (discontinuous across cell facets), or \"Raviart-Thomas\", among others, shape defines the shape of the finite element cell (\"interval\", \"triangle\" or \"tetrahedron\") and order is the order of the finite element basis (which is arbitrary). A finite element space which is suitable for modelling problems with discontinuous solutions has been created from the sum of the continuous and discontinuous element spaces. Not all FFC supported finite element spaces are currently compatible with the extended finite element implementation. We will focus on arbitrary order continuous Lagrange elements.  
Once the finite element spaces have been defined, test, trial and other functions can be defined on the appropriate spaces. For the Poisson equation presented in Section 3.2., we define the test and trial functions, \(v\) and \(u\), respectively, and the source function \(f\),  
v = TestFunctionPUM(element)  u = TrialFunctionPUM(element)  f = Function(elem_cont) The test and trial functions have been defined on the space of functions containing a discontinuity and the source function f is defined on a continuous finite element space.  
FFC provides a number of operators for computing terms such as inner products, gradients, the divergence and the transpose [6; 7; 13]. It is possible to use compact tensor or index notation. In the context of the extended finite element method, we define some operators which act at discontinuity surfaces. A common operation at a discontinuity surface is the computation of the jump in the field across the surface. For this, we provide the operator djump(u) which is equivalent to \(u^{+}-u^{-}\), and the operator ljump(u, n) which returns the jump in the vector \(\mathbf{u}^{+}-\mathbf{u}^{-}\), but with the components of the jump relative to the local \(n-s\) coordinate system in which the \(n\)-direction is normal to the discontinuity surface and the \(s\)-direction is tangential to the discontinuity surface. Another ingredient is integration over discontinuity surfaces which is denoted by *dc. The range of operators at discontinuity surfaces is currently limited. More elaborate operators, akin to those already available on cell facets [8], are under development.  
We have now introduced the necessary language elements to represent a finite element variational formulation of the Poisson problem with a discontinuous solution across a surface and a flux acting at the discontinuity surface which is a function of the solution jump, as presented in Equation (14). For a quadratic Lagrange basis, and the constitutive model for the discontinuity surface flux \(q=k\llbracket u\rrbracket\) where \(k\geq 0\) is a constant, the form compiler input for this problem reads:  
Finite element spaces  elem_cont = FiniteElement(\"Lagrange\", \"triangle\", 2)  elem_discont = DiscontinuousFiniteElement(\"Lagrange\", \"triangle\", 2)  element = elem_cont + elem_discont