← Back to team overview

dolfin team mailing list archive

Re: pydolfin

 

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?
>
> --
> Anders

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>?

--
Martin


Follow ups

References