Complexity of function evaluation


107
views
0
3 months ago by
When evaluating a FE function at `x`, one first needs to find the simplex in which `x` is located.
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
2
Search for a cell using bounding box tree will be somemething like O(log(number_cells)).
written 3 months ago by Jan Blechta  

1 Answer


2
3 months ago by
Nate  
The python call you've shown calls
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.

Similar posts:
Search »