I am very new to fenics and hope this is not too naive a question.
I am trying to upgrade from a fenics 2017.2, python2 environment to fenics 2019.0, python3. I am running into problems with the Expression function, which works in the first environment but not the second. Below I try to come up with a minimal working example using the sample cppcode from:
https://fenicsproject.org/docs/dolfin/1.6.0/python/programmers-reference/functions/expression/Expression.html
The following compiles fine in fenics 2017.2, python2
from dolfin import *
code = '''
class MyFunc : public Expression
{
public:
std::shared_ptr<MeshFunction<std::size_t> > cell_data;
MyFunc() : Expression()
{
}
void eval(Array<double>& values, const Array<double>& x,
const ufc::cell& c) const
{
assert(cell_data);
const Cell cell(*cell_data->mesh(), c.index);
switch ((*cell_data)[cell.index()])
{
case 0:
values[0] = exp(-x[0]);
break;
case 1:
values[0] = exp(-x[2]);
break;
default:
values[0] = 0.0;
}
}};'''
f = Expression(code, degree=3)
but in 2019.0, python3 I get
Which seems to indicate something’s wrong with the cppcode.