Dear all,
Currently, I’m translating in FEniCS python into Dolfin C++ (for multi-nodes run on cluster). Thanks to the collection of demos, all the problems have been solved, except one: the various overloads of the eval function.
For example, this expression in Python
init_condition=Expression((‘sqrt( pow(x[0],2) + pow(x[1],2) )<3e-5 ? 120 : 0.0’), degree=1)
becomes in C++
class InitialConditions : public Expression
{
public:
InitialConditions() : Expression() {}
void eval(Array& values, const Array& x) const
{
if (sqrt( pow(x[0],2) + pow(x[1],2) )<3e-5)
{
values[0]=120.0;
} else values[0]=0.0;
}
};
But I’m stuck on this one, where I have to call a function inside the expression:
expr_rho = Expression((‘wrho<1e-12 ? 0.0 : (wrho > 1e-5 ? 1e-5 : wrho)’),wrho=wrho,degree=1)
I’ve not found example of this online, and can’t manage to do it by myself, does someone have a lead?
Thank you very much for your time!