← Back to team overview

dolfin team mailing list archive

Re: PyDOLFIN Function

 



Anders Logg wrote:
On Mon, Sep 15, 2008 at 03:06:55PM +0200, Johan Hake wrote:
On Monday 15 September 2008 14:29:08 Garth N. Wells wrote:
Could a Python expert take a look at site-packges/dolfin/function.py?
The code directly following the comment

  # Special case, Function(element, mesh, x), need to create simple form
to get arguments

need to be updated but I don't understand it well.
The first special case is for initializing a Function with a given Vector, by constructing a dofmap from the handed element.

As constructing a Function from a vector is removed from the cpp interface, and we have not, (or have we?) figured out how to wrap a shared_ptr in swig, we should probably just remove the first case for now.

Johan

The question is how we want to create discrete Functions in Python.
Previously, this was done by

  u = Function(element, mesh, Vector())

but now the third argument is not needed anymore. If we remove it,
we get

  u = Function(element, mesh)

but that doesn't work since that is the way to initialize a
user-defined function (something overloading eval()).

We could put in a flag and make "discrete" the default. Then all
user-defined functions need to set the flag to "user".

Suggestions? This is a good time to worry about how we want to design
the Function interface.


Sounds ok to me. This is basically what Vector() was doing, and a flag would be more descriptive.

Garth




------------------------------------------------------------------------

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev



Follow ups

References