← Back to team overview

dolfin team mailing list archive

Re: Even more Expression problems

 

On Friday 16 October 2009 15:24:42 Anders Logg wrote:
> On Fri, Oct 16, 2009 at 03:14:24PM +0200, Johan Hake wrote:
> > On Friday 16 October 2009 15:09:03 Anders Logg wrote:
> > > Here's another problem I just ran into:
> >
> > You just keep bring it on do you!! ;)
> >
> > I wonder why I keep thinking:
> >
> >    unittest, unittest, unittest ...
> 
> Good idea. :-)
> 
> > > class BoundaryValue(Expression):
> > >     def eval(self, values, x):
> > >         values[0] = ...
> > >
> > > This works:
> > >
> > >   g = BoundaryValue(V)
> > >
> > > or
> > >
> > >   g = BoundaryValue(V=V)
> > >
> > > But this does not work:
> > >
> > >   g = BoundaryValue(element=element)
> > >
> > > I get this error:
> > >
> > > Exception: Swig director method error. Error detected when calling
> > > 'Expression.eval_data'
> > >
> > > when calling bc.apply() with the above function as argument (which
> > > results in a call to eval).
> >
> > Could you pass a minimal script that reproduce it so I can look into it?
> 
> Sorry, my fault. I forgot that the "Swig director method" error
> signals that I have done something wrong inside the eval function
> which I had or rather I had initialized with the wrong element so I
> wasn't allowed to set values[1]...

Ok!

It should be possible to access the original error message. That would have 
helped you in this case.

Johan



Follow ups

References