← Back to team overview

dolfin team mailing list archive

Re: SubFunctions

 



Anders Logg wrote:
On Mon, Aug 17, 2009 at 01:03:55PM +0100, Garth N. Wells wrote:

Johan Hake wrote:
On Monday 17 August 2009 13:33:21 Garth N. Wells wrote:
Please send any comments on how a SubFunction should work as I'm going
to work on it soon (the Cahn-Hilliard demo runs in parallel(!) ;) with
the exception of the extraction of sub-Functions for output). I'm
inlined to change a sub function such that for

   Function u0 = u[0]

the Function u0 will only point the vector belonging to u rather than
creating a new vector. The advantages are:

- No need to copy a vector
- DofMap will not require 'is_view'
- Possible to do things like
    u0  = 0.0;
    u1  += v;
    u0.interpolate();
What would Function::vector() for a SubFunction then return? The original full
Vector?

Yes.

It would be cool to add a view of the original Vector that only represents the
values of the dofs in the SubFunction, without coping data. I fiddled around
with this when adding slicing for the PyDOLFIN la interface, but realized that
it would be too difficult.

This is more or less what I plan to do, although internally. A user
wouldn't see the vector, but operations like interpolate would only
involve part of the vector.

We could add a class like

   VectorView(GenericVector& x, DofMap& dof),

which could derive from GenericVector, to provide views. It isn't a
priority for me though.

Garth

Sounds like this could be coordinated/merged with the functionality
required for the parallel get()/gather(). It's much the same thing,
being able to address a vector with dofs which don't correspond to the
entries in the vector.


Yes.

We need a bug tracking system to keep track of suggested features ;).

Garth


--
Anders


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

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




Follow ups

References