2009/2/13 Kent Andre <[email protected]>: > On fr., 2009-02-13 at 15:01 +0000, A Navaei wrote: >> 2009/2/13 Kent Andre <[email protected]>: >> > On fr., 2009-02-13 at 13:12 +0000, A Navaei wrote: >> >> his error in python: >> >> >> >> File >> >> "/usr/lib/InsightToolkit/WrapITK/lib/itkImageToDolfinFunctionPython.py", >> >> line 273, in Convert >> >> return >> >> _itkImageToDolfinFunctionPython.itkImageToDolfinFunctionID2_Convert(*args) >> >> RuntimeError: *** Error: Unable to assign to function, missing >> >> coefficients (user-defined function). >> > >> > This is caused by the following: >> >> Yes, I've noticed this. But why doesn't this error happen when calling >> the sub-class from python? Why should v._vector be null when the >> cub-class is called from c++? > > There are some magic that goes on in the python version of Function. > Hake is the master of this function, so I cc him.
Johan: Why the extensions in dolfin/site-packages/function.py are not implemented in c++ and then wrapped in python? It seems focusing some parts of the development in the python layer has caused some stuff to be missed in the c++ core. For reference I copy the previous communication with Kent: ---------------------------- There are some issues with coding dolfin under c++, a code which works with python is difficult, if not impossible, to re-produce in c++. I tried sub-classing dolfin::Function as itk::DolfinImageFunction: http://code.google.com/p/wrapitk/source/browse/trunk/ExternalProjects/ItkDolfin/src/itkDolfinImageFunction.h After wrapping in python, using wrapped itk::DolfinImageFunction works fine in python, but the same procedure fails when implemented in c++, as demonstrated here: http://code.google.com/p/wrapitk/source/browse/trunk/ExternalProjects/ItkDolfin/src/itkImageToDolfinFunction.h#56 which generates this error in python: File "/usr/lib/InsightToolkit/WrapITK/lib/itkImageToDolfinFunctionPython.py", line 273, in Convert return _itkImageToDolfinFunctionPython.itkImageToDolfinFunctionID2_Convert(*args) RuntimeError: *** Error: Unable to assign to function, missing coefficients (user-defined function). Here is the python test generating the above error: http://code.google.com/p/wrapitk/source/browse/trunk/ExternalProjects/ItkDolfin/tests/test-01.py _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
