← Back to team overview

dolfin team mailing list archive

Re: Wrapping Function

 

On Tuesday 10 February 2009 15:39:13 A Navaei wrote:
> 2009/2/10 Johan Hake <hake@xxxxxxxxx>:
> > On Tuesday 10 February 2009 13:51:28 A Navaei wrote:
> >> I am trying to wrap the c++ itk-dolfin interface in python, and since
> >> the input/output type interfacing dolfin is Function, the access to
> >> the c wrapper proxy layer is required. Between many available types of
> >> Function, the one which is useful for the interface is
> >> Function(FunctionSpace V), which is wrapped in swig generated file
> >> cpp.py. However, the associated auto-generated c header seems to be
> >> excluded in the packaging, at least I was not able to locate it. I'm
> >> not sure if using swig directors, or including
> >> /usr/include/dolfin/swig/directors.i would help this too.
> >>
> >> Is there a better way of making the python class Function visible to
> >> c++?
> >
> > Do you have an itk-dolfin function implemented in c++ and want to make
> > that visible for the python interface? If you do not want to do this in
> > python, e.g.,
> >
> > class ItkFunction(Function):
> >   def eval(values,x):
> >       # some calls to itk stuff
> >       values[0] = ...
> >
> > you need to create your own swig generated extension module that %imports
> > the swig generated dolfin types by inlcuding:
> >
> >   %import dolfin/swig/dolfin.i
>
> dolfin/swig/dolfin.i includes dolfin/swig/directors.i which I was
> using. It tured out the problem was initiated from gccxml, which is
> used for parsing templates in itk, not liking the use of boost in
> dolfin. Eliminating that, and including dolfin.i or directors.i, it
> builds now.

Good!

Sounds that you know your way around ;)

Johan


References