← Back to team overview

dolfin team mailing list archive

Re: Patch for pyDolfin function.py

 

On Thursday 21 August 2008 23:05:57 Evan Lezar wrote:
> Hi
>
> I added a simple warning message to the Function constructor in function.py
> which is displayed if the constructor is called with 3 arguments and the
> last one is not an instance of dolfin.Vector or Matrix.
>
> I know that a warning is not a necessarily a long-term solution, but it
> would at least assist new users such as myself in tracking down the source
> of errors in their code.

Fine that you found out what your problem was!

Your issue again illustrates the limitation Function in pydolfin. We should 
really update at least the docstrings, together with more exstensive 
testings. For example could these lines be expanded: 

     # Otherwise give all to DOLFIN
     else:
         dolfin.cpp_Function.__init__(self, *((element,) + others))

so that we only send valid arguments to the cpp_Function constructor.

A while ago I implemented a way of instantiate a discrete function using a 
numpy array. I promised Martin to send a patch to him for inclusion but faild 
to do it. Please apply Evans patch then I can hand a patch for the numpy 
array initialization after that.

Johan


Follow ups

References