# Interpolations

## Type definitions

Interpolations are subtypes of `Interpolation{dim, shape, order}`

, i.e. they are parametrized by the (reference element) dimension, reference shape and order.

### Fallback methods applicable for all subtypes of `Interpolation`

`Ferrite.getdim`

— Method`Ferrite.getdim(::Interpolation)`

Return the dimension of the reference element for a given interpolation.

`Ferrite.getrefshape`

— Method`Ferrite.getrefshape(::Interpolation)::AbstractRefShape`

Return the reference element shape of the interpolation.

`Ferrite.getorder`

— Method`Ferrite.getorder(::Interpolation)`

Return order of the interpolation.

`Ferrite.value`

— Method`Ferrite.value(ip::Interpolation, ξ::Vec)`

Return a vector, of length `getnbasefunctions(ip::Interpolation)`

, with the value of each shape functions of `ip`

, evaluated in the reference coordinate `ξ`

. This calls `Ferrite.value(ip::Interpolation, i::Int, ξ::Vec)`

, where `i`

is the shape function number, which each concrete interpolation should implement.

`Ferrite.derivative`

— Method`Ferrite.derivative(ip::Interpolation, ξ::Vec)`

Return a vector, of length `getnbasefunctions(ip::Interpolation)`

, with the derivative (w.r.t. the reference coordinate) of each shape functions of `ip`

, evaluated in the reference coordinate `ξ`

. This uses automatic differentiation and uses `ip`

s implementation of `Ferrite.value(ip::Interpolation, i::Int, ξ::Vec)`

.

`Ferrite.boundarydof_indices`

— Function`boundarydof_indices(::Type{<:BoundaryIndex})`

Helper function to generically dispatch on the correct dof sets of a boundary entity.

### Required methods to implement for all subtypes of `Interpolation`

to define a new finite element

Depending on the dimension of the reference element the following functions have to be implemented

`Ferrite.value`

— Method`value(ip::Interpolation, i::Int, ξ::Vec)`

Evaluates the `i`

'th basis function of the interpolation `ip`

at a point `ξ`

on the reference element. The index `i`

must match the index in `vertices(::Interpolation)`

, `faces(::Interpolation)`

and `edges(::Interpolation)`

.

For nodal interpolations the indices also must match the indices of `reference_coordinates(::Interpolation)`

.

`Ferrite.vertexdof_indices`

— Method`vertexdof_indices(ip::Interpolation)`

A tuple containing tuples of local dof indices for the respective vertex in local enumeration on a cell defined by `vertices(::Cell)`

. The vertex enumeration must match the vertex enumeration of the corresponding geometrical cell.

`Ferrite.facedof_indices`

— Method`facedof_indices(ip::Interpolation)`

A tuple containing tuples of all local dof indices for the respective face in local enumeration on a cell defined by `faces(::Cell)`

. The face enumeration must match the face enumeration of the corresponding geometrical cell.

`Ferrite.facedof_interior_indices`

— Method`facedof_interior_indices(ip::Interpolation)`

A tuple containing tuples of the local dof indices on the interior of the respective face in local enumeration on a cell defined by `faces(::Cell)`

. The face enumeration must match the face enumeration of the corresponding geometrical cell. Note that the vertex and edge dofs are included here.

`Ferrite.edgedof_indices`

— Method`edgedof_indices(ip::Interpolation)`

A tuple containing tuples of local dof indices for the respective edge in local enumeration on a cell defined by `edges(::Cell)`

. The edge enumeration must match the edge enumeration of the corresponding geometrical cell.

`Ferrite.edgedof_interior_indices`

— Method`edgedof_interior_indices(ip::Interpolation)`

A tuple containing tuples of the local dof indices on the interior of the respective edge in local enumeration on a cell defined by `edges(::Cell)`

. The edge enumeration must match the edge enumeration of the corresponding geometrical cell. Note that the vertex dofs are included here.

`Ferrite.celldof_interior_indices`

— Method`celldof_interior_indices(ip::Interpolation)`

Tuple containing the dof indices associated with the interior of the cell.

`Ferrite.getnbasefunctions`

— Method`Ferrite.getnbasefunctions(ip::Interpolation)`

Return the number of base functions for the interpolation `ip`

.

`Ferrite.reference_coordinates`

— Method`reference_coordinates(ip::Interpolation)`

Returns a vector of coordinates with length `getnbasefunctions(::Interpolation)`

and indices corresponding to the indices of a dof in `vertices`

, `faces`

and `edges`

.

```
Only required for nodal interpolations.
TODO: Separate nodal and non-nodal interpolations.
```

for all entities which exist on that reference element. The dof functions default to having no dofs defined on a specific entity. Hence, not overloading of the dof functions will result in an element with zero dofs. Also, it should always be double checked that everything is consistent as specified in the docstring of the corresponding function, as inconsistent implementations can lead to bugs which are really difficult to track down.