dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #12052
Re: Wrapping Function
On ti., 2009-02-10 at 14:39 +0000, 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.
>
>
> -Ali
Great work!
How do I compile the ItkDolfin module ?
Kent
>
> >
> > in your interface file. If you are new to swig, this can be a steep hill to
> > climb though. You can try to use instant, and look at the compile_function.py
> > file in DOLFIN.
> >
> > A second alternative could be to look into the result of the call to instant
> > from compile_function, that would be the cache of instant:
> >
> > ~/.instant/cache/dolfin_compile_function_XXX
> >
> > Look into the files that is contained in that directory and you will get a
> > hint of what you need. Note that each directory is an extension module.
> >
> >
> > Johan
> >
> >>
> >> -Ali
> >> _______________________________________________
> >> DOLFIN-dev mailing list
> >> DOLFIN-dev@xxxxxxxxxx
> >> http://www.fenics.org/mailman/listinfo/dolfin-dev
> >
> >
> >
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
Follow ups
References