Function::operator= does not handle the case where "this" is a subfunction.

Bug #1259022 reported by Ennio Barbaro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Invalid
Undecided
Unassigned

Bug Description

Consider the code:

Function F,U; //Assume F and U are initialized properly

F[0] = U;

The result of this function is:

F[0]._vector != F._vector.

F[0]._function_space is potentially not a subspace of F._function_space.

No error of any kind are prompted.
operator=(const Function & v) should behave as:

1) Make the assignment illegal if "this" is a subfunction and this->_function_space != v._function_space
2) Overwrite only the relevant entries of this->_vector

At the moment is quite counter-intuitive and also very hard to debug, since if you plot F[0] you obtain the function you just assigned, while F is something completely unrelated.

Revision history for this message
Johannes Ring (johannr) wrote :

FEniCS no longer uses Launchpad for bug reports. Please consult the documentation on the FEniCS web page for where and how to (re)post your bug report: http://fenicsproject.org/support/

Changed in dolfin:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.