Subfunction assignment broken

Issue #170 wontfix
Ennio Barbaro created an issue

The code:

Function f (function_space);
Function u(function_space[0].collapse());
f[0] = u;

is broken. The assignment operator of Function does not handle the case where this is a subfunction.

Moreover, the current state of the assignment operator permits to assign to a subfunction a function which can potentially have a completely unrelated function space.

Function::operator= needs to handle the case where this is a subfunction. For instance it can throw throw if the function spaces are incompatible and copy the right vector values otherwise.

Comments (4)

  1. Johan Hake

    Could you please hand a minimum but runnable code reproducing the error?

    With the FunctionAssigner in place I wonder if Function::operator=(const Function& v) only should allow assignment of full Functions (not sub Function) within the same FunctionSpace.

  2. Ennio Barbaro reporter

    I attached a short example. Maybe Function::operator= should be partially refactored in terms of assign (I just noticed the FunctionAssigner class, very nice).

  3. Log in to comment