### Complexity of function evaluation

107

views

0

When evaluating a FE function at `x`, one first needs to find the simplex in which `x` is located.

Where can I find info on how FEniCS does this; I'm especially interested in the complexity.

```
from dolfin import *
mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, 'CG', 1)
f = Expression('x[0]*x[0] + x[1]', degree=2)
fp = project(f, V)
fp([0.5234, 0.3128])
```

Where can I find info on how FEniCS does this; I'm especially interested in the complexity.

Community: FEniCS Project

### 1 Answer

2

The python call you've shown calls

which finds the intersecting cell using a bounding box tree, then evaluates f on that cell via

It's

`void Function::eval(Array<double>& values, const Array<double>& x)`

which finds the intersecting cell using a bounding box tree, then evaluates f on that cell via

`void Function::eval(Array<double>& values, const Array<double>& x, const Cell& dolfin_cell, const ufc::cell& ufc_cell) const`

It's

**much**cheaper if you know the cell a priori.
Please login to add an answer/comment or follow this question.

`O(log(number_cells))`

.