DirichletBC copy constructor broken in Python interface

Bug #913698 reported by Patrick Farrell
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
High
Johan Hake

Bug Description

According to the docstring for DirichletBC.__init__, there should be a copy constructor for DirichletBC objects. However, the following code:

from dolfin import *
mesh = UnitSquare(4, 4)
V = FunctionSpace(mesh, "CG", 1)
bc = DirichletBC(V, 1.0, "on_boundary")
newbc = DirichletBC(bc)

gives an exception:

Traceback (most recent call last):
  File "/tmp/py", line 5, in <module>
    newbc = DirichletBC(bc)
  File "/usr/lib/python2.7/dist-packages/dolfin/fem/bcs.py", line 89, in __init__
    if isinstance(args[1], cpp.Expression):
IndexError: tuple index out of range

instead of copying the boundary condition as expected.

Related branches

Revision history for this message
Johan Hake (johan-hake) wrote : Re: [Bug 913698] [NEW] DirichletBC copy constructor broken in Python interface

Thanks for reporting. Should be fixed now.

Johan

On Monday January 9 2012 11:19:53 Patrick Farrell wrote:
> Public bug reported:
>
> According to the docstring for DirichletBC.__init__, there should be a
> copy constructor for DirichletBC objects. However, the following code:
>
> from dolfin import *
> mesh = UnitSquare(4, 4)
> V = FunctionSpace(mesh, "CG", 1)
> bc = DirichletBC(V, 1.0, "on_boundary")
> newbc = DirichletBC(bc)
>
> gives an exception:
>
> Traceback (most recent call last):
> File "/tmp/py", line 5, in <module>
> newbc = DirichletBC(bc)
> File "/usr/lib/python2.7/dist-packages/dolfin/fem/bcs.py", line 89, in
> __init__ if isinstance(args[1], cpp.Expression):
> IndexError: tuple index out of range
>
> instead of copying the boundary condition as expected.
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New

Changed in dolfin:
status: New → Fix Committed
assignee: nobody → Johan Hake (johan-hake)
importance: Undecided → High
milestone: none → 1.0.1
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.