Expansion coefficient

Hi, I am wondering what the restrict function is doing in Function object?, specifically
*void restrict(double *w, const FiniteElement &element, const Cell &dolfin_cell, const double vertex_coordinates, const ufc::cell &ufc_cell) const
Restrict function to local cell (compute expansion coefficients w)

Arguments
w (list of doubles)
Expansion coefficients.
element (FiniteElement)
The element.
dolfin_cell (Cell)
The cell.
ufc_cell (ufc::cell).
The ufc::cell.

what is the expansion coefficients w representing?

You may want to take a look at this document.

Thanks for your reply, I actually copied the restrict function prototype from function.h, I wonder is the expansion coefficient the dof value of function?

That is true. DOFs (expansion coefficients) are the quantities you want to compute.

For nodal finite elements (which in FEniCS all should be) expansion coefficients are values of degrees of freedom \phi_j: P \rightarrow \mathbb R.

Trivially for f \in P you have
\phi_j(f) = \phi_j(\sum_{i=1}^N c_i b_i) = \sum_{i=1}^N c_i \phi_j(b_i) = \sum_{i=1}^N c_i \delta_{ij} = c_j.

What method restrict does is local interpolation of the owning Function into provided finite element (const FiniteElement &element). It needs also some information about cell (vertex coordinates) to compute geometric quantities for non-affine mapped elements.
The result is an array of N values stored into double *w, where N is local dimension of the finite element on that cell.

If you are for example restricting P1 function to P2 finite element, then P1 function is evaluated at degrees of freedom of P2 space (located at vertices and midpoints for triangle) and these are stored into w.

1 Like

the value of w should be the dof of element at that cell? it is a vector of dof value right?

It is just preallocated array in memory which will be filled with (expansion coefficients)=(values of dofs) during the call. It is passed via pointer.