dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #10956
Re: Problems in assemble.py
2008/12/5 Johan Hake <hake@xxxxxxxxx>:
> On Friday 05 December 2008 08:55:44 Martin Sandve Alnæs wrote:
>> 2008/12/4 Johan Hake <hake@xxxxxxxxx>:
>> > On Thursday 04 December 2008 20:44:20 Anders Logg wrote:
>> >> I have moved the jit function and the code from get_dolfin_form to
>> >> separate modules.
>> >>
>> >> The JIT compilation seems to work fine, but the _ufc_form member in
>> >> the generated dolfin::Form subclass seems to be zero. See comment at
>> >> the top of the the assemble function.
>> >>
>> >> Any ideas what goes wrong? If we get this working, we can remove most
>> >> of the code from assemble.py and reuse it also in pde.py.
>> >
>> > It is fixed now.
>> >
>> > This is the same problem we have with the compiled elements and dofmaps
>> > in FunctionSpace. You need to store a reference to the compiled form,
>> > otherwise swig will garbage collect the form when it goes out of scope,
>> > killing also the actuall cpp_ufc_form.
>>
>> This is the kind of issue I'm hoping SWIGs shared_ptr bindings can help us
>> with.
>
> True. But I had no luck with it. I do not know where the error resides. I
> actually made a minimal test .cpp file I wrapped with swig, using both
> shared_ptr and raw pointers. This behaved as expected. Swig garbage collected
> the objects stored with raw pointers, but did not do it for the shared_ptr
> stored one. So it _should_ just work.
>
> Johan
Can you share this test code? Details are rather important for this stuff :)
Maybe swig chooses the reference versions of dolfin::foo constructors.
--
Martin
Follow ups
References