← Back to team overview

dolfin team mailing list archive

DOLFIN_EPS and Expressions

 

How is DOLFIN_EPS treated in Expressions and boundary conditions
(using compile_subdomains)?

I thought that DOLFIN_EPS was known to the JIT compiler.

Here are somethings I noted while debugging a code:

1. f = Expression("sin(x[0] + DOLFIN_EPS)") does not compile.

The log file pointed to by the JIT compiler says "syntax error" and the
generated code in .i file found in the same directory contains this:

class Expression_5d66d4e2b02f54f6088fc61767e40073: public Expression
{
public:
  double DOLFIN_EPS;
  Expression_5d66d4e2b02f54f6088fc61767e40073():Expression()
  {

    DOLFIN_EPS = 0.0;
  }

  void eval(dolfin::Array<double>& values, const
  dolfin::Array<double>& x) const
  {
    values[0] = sin(x[0] + DOLFIN_EPS);
  }
};

So there are two problems here:

1.a) The JIT compiler fails to compile the Expression f which looks
like a valid expression to me

1.b) DOLFIN_EPS is set to zero.

2. When trying something similar with compile_subdomains, it seems
that

  compile_subdomains("x[0] < DOLFIN_EPS")

compiles and produces correct code. In particular the .i file does not
contain DOLFIN_EPS = 0.0.

But the magic for creating variables is a bit too clever. I had a typo
which said "DOFLIN_EPS" instead of "DOLFIN_EPS" which compiles without
any warnings and DOFLIN_EPS is set to zero. That's a litle dangerous.

--
Anders



Follow ups