← Back to team overview

dolfin team mailing list archive

eval query

 

Hi All,
I'm trying to update a working 0.9.3 code to 0.9.4, and I need to understand the new interfaces for Function::eval a bit better.

I had things working fine with the old interface

Function::eval (double *values, const double *x, const ufc::cell &ufc_cell, uint cell_index)

and am trying to understand how to efficiently use

Function::eval (double *values, const double *x, const Cell &dolfin_cell, const ufc::cell &ufc_cell)

(My codes need to do a large number of evals at arbitrary points and cells efficiently)

among other things, is there an easy way to update the index of a cell, without constructing a new Cell every time? (or shouldn't I be worrying about this).

Anyway, I need to play with things a bit more, but looking at the source code for eval, I was also wondering if lines 320 and 321 are required as line 322 doesn't seem to require cell.

 typo? bug? or general ignorance on my part (probably the latter).

cheers
marc

void Function::eval(double* values, const Data& data) const
00311 {
00312   assert(values);
00313   assert(_function_space);
00314
00315   // Check if UFC cell if available and cell matches
00316 if (data._dolfin_cell && _function_space->has_cell (*data._dolfin_cell))
00317   {
00318     // Efficient evaluation on given cell
00319     assert(data._ufc_cell);
00320 const uint cell_index = data._ufc_cell->entity_indices [data._ufc_cell->topological_dimension][0];
00321     Cell cell(_function_space->mesh(), cell_index);
00322     eval(values, data.x, *data._dolfin_cell, *data._ufc_cell);
00323   }
00324   else
00325   {
00326     // Redirect to point-based evaluation
00327     eval(values, data.x);
00328   }
00329 }
----------------------------------------------------
Marc Spiegelman
Lamont-Doherty Earth Observatory
Dept. of Applied Physics/Applied Math
Columbia University
http://www.ldeo.columbia.edu/~mspieg
tel: 845 704 2323 (SkypeIn)
----------------------------------------------------



Follow ups