← Back to team overview

dolfin team mailing list archive

Re: SubFunctions

 



Anders Logg wrote:
On Mon, Aug 17, 2009 at 12:33:21PM +0100, 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();

Do all these only affect the part of the vector occupied by either u0
or u1?


Yes, that's the idea.

Garth

Disadvantages are:

- It may be unclear that u0 and u share data.
- If u goes out of scope, u0 is will keep the vector belonging to u
alive (only an issue if the vector is very large compared to that
required by u0).

Sounds ok to me.

--
Anders


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

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


References