dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #21413
Re: DOLFIN_EPS and Expressions
On 11 February 2011 10:16, Anders Logg <logg@xxxxxxxxx> wrote:
> 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.
I had the same experience with DOLFIN_PI,
Expression("sin( DOLFIN_PI*x[0] )") --> compile error
while using 'pi' worked fine,
Expression("sin( pi*[0] )")
Kristian
> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp
>
References