dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #09288
Re: pydolfin
2008/8/22 Anders Logg <logg@xxxxxxxxx>:
> On Fri, Aug 22, 2008 at 09:35:00AM +0200, Martin Sandve Alnæs wrote:
>> 2008/8/21 Anders Logg <logg@xxxxxxxxx>:
>> > It works if you replace
>> >
>> > Function(element, mesh, h_e)
>> >
>> > by
>> >
>> > Function(element, mesh, Vector())
>> >
>> > You should get an error message when trying to create a Function from
>> > a numpy array (unless Martin has done some tricks for initialization
>> > of vector constants that I have missed).
>> >
>> > Martin?
>> >
>>
>> I did implement initialization of vector constant functions,
>> but I never touched the array typemaps. The numpy typemaps
>> in general needs improvement, probably best done by
>> using the numpy.i as someone previously suggested?.
>>
>> By the way, the following gives a rather bad error message:
>>
>> from dolfin import *
>> m = UnitSquare(1,1)
>> v = Vector()
>> f = cpp_Function(m, v)
>>
>> terminate called after throwing an instance of 'std::length_error'
>> what(): vector::reserve
>>
>> This happends in the constructor for vector constant functions:
>>
>> Function(Mesh mesh, dolfin::Array<(dolfin::real)> values) -> cpp_Function
>>
>> and I'm not sure exactly what happens.
>>
>> But why is there a typemap from Vector to dolfin::Array<real>?
>
> I don't know. Remove it and see if someone complains. Where is this
> typemap defined?
>
> --
> Anders
I have no idea. I tried some quick searching in the .i files, but can't find it.
Difficult to remove then...
I don't have time to dig further into the typemaps, there's a reason
I didn't do that when extending Function in the first place...
--
Martin
References