On Tuesday 06 October 2009 23:56:37 Johan Hake wrote: > On Tuesday 06 October 2009 23:49:22 Garth N. Wells wrote: > > Johan Hake wrote: > > > On Tuesday 06 October 2009 23:42:52 Garth N. Wells wrote: > > >> Johan Hake wrote: > > >>> On Tuesday 06 October 2009 23:33:39 DOLFIN wrote: > > >>>> One or more new changesets pushed to the primary dolfin repository. > > >>>> A short summary of the last three changesets is included below. > > >>>> > > >>>> changeset: 7297:91e8cb87b971 > > >>>> tag: tip > > >>>> user: "Garth N. Wells <gn...@cam.ac.uk>" > > >>>> date: Tue Oct 06 22:33:27 2009 +0100 > > >>>> files: dolfin/swig/function_pre.i > > >>>> description: > > >>>> PyDOLFIN update for new Function interface > > >>>> > > >>>> %rename(eval_data) dolfin::GenericFunction::eval(double* values, > > >>>> const Data& data) const; > > >>>> > > >>>> I changed this to 'GenericFunction' from 'Function'. Should it be > > >>>> > > >>>> %rename(eval_data) dolfin::Function::eval(double* values, const > > >>>> Data& data) const; > > >>>> %rename(eval_data) dolfin::Expression::eval(double* values, const > > >>>> Data& data) const; > > >>> > > >>> Probably just the last one. It is this that is overloaded from > > >>> Python. > > >>> > > >>> Do not see the immediate point of renaming GenericFunction.eval_data. > > >> > > >> This change fixed my problem with > > >> > > >> "Exception: Swig director method error. Error detected when calling > > >> 'Expression.eval'" > > > > > > Subtle... but great! > > > > But is it correct to rename the function in the base class, or should I > > have done
It should be correct to rename the base class as you have done. I have looked into it and in the eval(value,data) method in the C++ director class that SWIG generates, the Python call back is performed. This just call the eval_data method on the Python objects. SWIG does not generate Python methods code in derived classes for virtual methods. This means that the Python method call ends up in the base class. I have added a comment about this in function_pre.i Johan > > %rename(eval_data) dolfin::Function::eval(double* values, const Data& > > data) const; > > > > %rename(eval_data) dolfin::Expression::eval(double* values, const Data& > > data) const; > > Beats me. > > I thought it was enough to rename Expression, as it is the only one we need > to overload from Python. We rename it so SWIG can figure out which eval we > overload. > > But SWIG does a lot of stuff behind the scene here. Call are dispatched up > and down class hierarchy, from python to cpp and back, so I can only > guess. > > Trial and error, together with documentation of why one ends up with any > directive in the SWIG interface files has worked for me. > > Johan > > > ? > > > > Garth > > > > > Johan > > > > > >> Garth > > >> > > >>> Johan > > >>> > > >>>> ? > > >>>> > > >>>> > > >>>> changeset: 7296:043de1021325 > > >>>> user: "Garth N. Wells <gn...@cam.ac.uk>" > > >>>> date: Tue Oct 06 22:09:52 2009 +0100 > > >>>> files: dolfin/swig/docstrings.i dolfin/swig/fem_pre.i > > >>>> description: > > >>>> Some updates for new function interface. > > >>>> > > >>>> > > >>>> changeset: 7295:57d4ab05d93b > > >>>> user: Anders Logg <l...@simula.no> > > >>>> date: Tue Oct 06 22:45:01 2009 +0200 > > >>>> files: dolfin/function/Function.cpp > > >>>> description: > > >>>> Remove warning in compute_vertex_values > > >>>> > > >>>> -------------------------------------------------------------------- > > >>>>-- For more details, visit http://www.fenics.org/hg/dolfin > > >>>> _______________________________________________ > > >>>> DOLFIN-dev mailing list > > >>>> DOLFIN-dev@fenics.org > > >>>> http://www.fenics.org/mailman/listinfo/dolfin-dev > > >>> > > >>> _______________________________________________ > > >>> DOLFIN-dev mailing list > > >>> DOLFIN-dev@fenics.org > > >>> http://www.fenics.org/mailman/listinfo/dolfin-dev > > _______________________________________________ > DOLFIN-dev mailing list > DOLFIN-dev@fenics.org > http://www.fenics.org/mailman/listinfo/dolfin-dev > _______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@fenics.org http://www.fenics.org/mailman/listinfo/dolfin-dev