On Wed, Oct 07, 2009 at 10:59:28PM +0200, Johan Hake wrote: > On Wednesday 07 October 2009 22:33:06 Anders Logg wrote: > > On Wed, Oct 07, 2009 at 10:30:42PM +0200, Johan Hake wrote: > > > On Wednesday 07 October 2009 21:58:36 Garth N. Wells wrote: > > > > The Python mixed-poisson demo is failing in parallel because the > > > > extraction of sub-functions via split() is making a deep copy, even > > > > though it should be a 'shallow' copy. Any ideas on how to fix it? > > > > > > Yes I see now whats wrong... I thought that the assignment operator > > > somewhat kept the shallow copy. > > > > > > I think we need to add the hack we had previously in DiscreteFunction to > > > make it work again. Should we add this in Function directly or should I > > > try to subclass Function and implement that particular constructor? I > > > would prefer the first. > > > > What is the hack? Yes, it would be good to avoid creating a special > > subclass. > > It is this constructor we need. > > /// Sub-function constructor (shallow copy of the vector) > DiscreteFunction(Function& v, uint i) > { > // Check that vector exists > if (!v.has_vector()) > error("Unable to extract sub function, missing coefficients (user- > defined function)."); > > // Get sub-function (Function will store pointer to sub-Function) > Function& sub_function = v[i]; > > // Copy function space pointer > this->_function_space = sub_function._function_space; > > // Copy vector pointer > this->_vector = sub_function._vector; > }
Looks ok to me (except for the has_vector thing which has been removed). -- Anders
signature.asc
Description: Digital signature
_______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@fenics.org http://www.fenics.org/mailman/listinfo/dolfin-dev