Assigning a Function to another Function does not work.

Bug #453207 reported by Patrick Riesen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
High
Unassigned

Bug Description

There is an error when one wants to assign a Function to a new one:

Function copy = orig;

or

Function copy(orig);

raise both an error as

/scratch-second/priesen/FEniCS/build/include/boost/smart_ptr/shared_ptr.hpp:412:
typename boost::detail::shared_ptr_traits<T>::reference
boost::shared_ptr< <template-parameter-1-1> >::operator*() const [with T
= dolfin::GenericVector]: Assertion `px != 0' failed.

in

#3 0x00007f98fc291a09 in dolfin::Function::operator=
(this=0x7fff047d2810, v=@0x7fff047d29c0) at
/scratch-second/priesen/FEniCS/build/include/boost/smart_ptr/shared_ptr.hpp:412
#4 0x00007f98fc291d09 in Function (this=0x7fff047d2810,
v=@0x7fff047d29c0) at dolfin/function/Function.cpp:113

Workaround:

use

Function copy(V_orig);
copy.vector() = orig.vector();

Revision history for this message
Garth Wells (garth-wells) wrote :

Could you post the smallest possible complete program that reproduces the error?

Revision history for this message
Patrick Riesen (priesen) wrote :

compile a ufl form M.ufl with:

cell = interval
element = FiniteElement("CG", cell, 1)
q = TestFunction(element)
v = TrialFunction(element)

a = q*v*dx

compile the main program as:

#include <dolfin.h>
#include "M.h"

using namespace dolfin;

int main (int argc, char* argv[])
{

  UnitInterval mesh(10);
  M::FunctionSpace V(mesh);

  Function orig(V);
  orig.vector() = 1.0;

  Function copy = orig;

  Function copy2(orig);

  return 0;
}

Revision history for this message
Garth Wells (garth-wells) wrote :

I've added this code to

   sandbox/misc/cpp

(fenics.org server is down at the moment, will push soon) for testing.

Changed in dolfin:
status: New → Confirmed
importance: Undecided → High
milestone: none → 0.9.5
Revision history for this message
Garth Wells (garth-wells) wrote :

Should be fixed now. Please test (once the server is back up, at which point I'll push the changes).

Changed in dolfin:
status: Confirmed → Fix Committed
Changed in dolfin:
status: Fix Committed → Fix Released
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.