← Back to team overview

dolfin team mailing list archive

Re: pydolfin undefined global name

 

> On Thu, Jun 28, 2007 at 09:15:59PM +0200, Alessio Quaglino wrote:
>> >>
>> >> I've added the old module \elasticity-updated to the dolfin kernel,
>> >> updating it to version 0.7.0 and compliling it according to the guide
>> at
>> >> the address
>> http://www.fenics.org/wiki/Creating_a_DOLFIN_kernel_library;
>> >> everything seems to compile now but when I run a program using the
>> >> python
>> >> interface I get the message:
>> >>
>> >> global name 'ElasticityUpdatedSolver' is not defined
>> >>
>> >> I've tried to make the minimum amount of modifications to the
>> original
>> >> module, hence I don't know where the error can come from. Thanks.
>> >>
>> >> Regards,
>> >> Alessio Quaglino
>> >
>> > Hi!
>> >
>> > The file src/pydolfin/dolfin_headers.h (generated by
>> > src/pydolfin/generate.py)  controls which headers are included in the
>> > Python interface, so your headers are probably missing from there.
>>
>> Hej, thanks for the reply!
>> Yes the header was missing but now the compiler is unable to find it:
>>
>> dolfin_headers.h:65: Warning(201): Unable to find
>> 'dolfin/ElasticityUpdatedSolver.h'
>>
>> In any case, I think that the guide I linked above is wrong in the
>> beginning when it says to create dolfin_mylib.h in src/kernel/mylib, it
>> should be instead src/kernel/mylib/dolfin. I followed rest of the guide,
>> but I can't get rid of this warning.
>>
>>
>> > Note that much of the functionality of PyDOLFIN related to PDE solvers
> has
>> > been removed, so it might not be a straightforward port of your old
>> code
>> > to 0.7. Some possible options for how to proceed are:
>> >
>> > 1. Write solvers using C++ only for now.
>> > 2. Work on enabling the missing PyDOLFIN functionality.
>> > 3. Use an older version of DOLFIN which still has the needed
>> > functionality.
>> >
>> >   Johan
>>
>> Ok at the moment I'm just trying to polish elasticityupdatedsolver.cpp
>> in
>> order to move some of the functionalities I have implemented caotically
>> in
>> python there, such as the classes imported using import_header(). I will
>> see then if it's possible to update to dolfin 0.7.0 or if I have to go
>> back to 0.6.4.
>>
>> Regards,
>> Alessio
>
> If you are writing an application that just uses DOLFIN, you shouldn't
> need to mess with adding files to the DOLFIN source tree. Just install
> DOLFIN on your machine once (make install) and then develop your code
> in a separate directory and compile it against DOLFIN.
>
> /Anders

I will see if I can make it because I've already written an application
using the python interface but based onto the class
ElasticityUpdatedSolver, hence (as Johan suggested) either I rewrite my
application from scratch in C++ or I try to put gradually inside
ElasticityUpdatedSolver what is not available in pydolfin (much easier).

Anyway, regarding my problem, it's only the building of pydolfin which
can't find 'dolfin/ElasticityUpdatedSolver.h', while including the header
from a C++ program compiles normally, so it should already be added
correctly to the source tree.

Regards,
Alessio Quaglino