← Back to team overview

dolfin team mailing list archive

Re: DOLFIN_EPS and Expressions

 

On Friday February 11 2011 01:16:31 Anders Logg 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.
> 
> 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.

Now it doesn't.

> 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.

subdomain treats DOLFIN_EPS and on_boundary seperately.

> 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.

You cannot blame your typos on compile expressions ;)

Johan

> --
> Anders
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References