This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Function eval crashes when called twice

0 votes

Dear all,

I need to evaluate a function on some points, however, if I evaluate the function more than once it crashes with the following error:

*** Error:   Unable to evaluate function at point.
*** Reason:  The point is not inside the domain. Consider setting "allow_extrapolation" to allow extrapolation.
*** Where:   This error was encountered inside Function.cpp.
*** Process: unknown
*** 
*** DOLFIN version: 1.5.0
*** Git changeset:  f467b66dcfd821ec20e9f9070c7cef5a991dbc42

Of course using allow_extrapolation isn't helping. My code is simple:

auto u = linearElastic(m);

dolfin::Array<double> v1(2), v2(2), x1(2), x2(2);

x1[0] = 0.5;      x1[1] = 0.5;
x2[0] = 3.5;      x1[1] = 8.5;

dolfin::info("NUM PARAMETERS: %d", argc);
dolfin::info("VALUE RANK:     %d", u->value_rank());

u->eval(v1, x1);
dolfin::info("EVAL FIRST:     %g %g", v1[0], v1[1]);

u->eval(v2, x2);
dolfin::info("EVAL BOOM!:     %g %g", v2[0], v2[1]);

If you comment the second eval, no problem. To be completely honest, it crashes randomly with probability 0.9... yes, it crashes 9 times over 10.

Can you see where I made an error? This is a self-contained example code.

Thanks!

asked Mar 30, 2016 by senseiwa FEniCS User (2,620 points)

Is anyone using eval() with success?

...