← Back to team overview

dolfin team mailing list archive

Re: [Branch ~dolfin-core/dolfin/main] Rev 6069: Fix a bug in the assignment operator of EpetraMatrix

 

Here is a minimal script reproducing the bug

Johan

On Saturday August 6 2011 00:14:40 Johan Hake wrote:
> It looks like there is something going on with the assignment to an empty
> EpetraMatrix. When the Epetra_FECrsMatrix::operator= was called on an
> uninitialized object an assertion kicked in. Bug or feature on the Epetra
> side?
> 
> If it is possible we should probably initialize the Epetra_FECrsMatrix when
> an empty EpetraMatrix is created hopefull avoiding this.
> 
> For now I use the copy constructor of Epetra_FECrsMatrix that initialize
> the structures correctly before it uses the Epetra_FECrsMatrix::operator=.
> Then I just assign the newly copied Epetra_FECrsMatrix to the
> EpetraMatrix.
> 
> Johan
> 
> On Friday August 5 2011 21:24:52 Johan Hake wrote:
> > On Friday August 5 2011 13:26:52 Garth N. Wells wrote:
> > > On Aug 5 2011, Johan Hake wrote:
> > > >You are right. I will look at it this weekend.
> > > >
> > > > However, it "fixed" my problem with Epetra backend and Nonlinear
> > > > problem where I used the assignment operator when generating the
> > > > Jacobian.
> > > 
> > > Can you post some simple code to test against?
> > 
> > Attached is a slightly modified version of the Cahn-hillard demo.
> > 
> > Johan
> > 
> > > Garth
> > > 
> > > >Johan
> > > >
> > > >On Aug 5, 2011, at 7:24, "Garth N. Wells" <gnw20@xxxxxxxxx> wrote:
> > > >> This doesn't look right. Looks like a shallow copy.
> > > >> 
> > > >> Garth
> > > >> 
> > > >> On 04/08/11 00:02, noreply@xxxxxxxxxxxxx wrote:
> > > >>> ------------------------------------------------------------
> > > >>> revno: 6069
> > > >>> committer: Johan Hake <hake.dev@xxxxxxxxx>
> > > >>> branch nick: work
> > > >>> timestamp: Wed 2011-08-03 20:58:24 -0700
> > > >>> 
> > > >>> message:
> > > >>>  Fix a bug in the assignment operator of EpetraMatrix
> > > >>> 
> > > >>> modified:
> > > >>>  dolfin/la/EpetraMatrix.cpp
> > > >>> 
> > > >>> --
> > > >>> lp:dolfin
> > > >>> https://code.launchpad.net/~dolfin-core/dolfin/main
> > > >>> 
> > > >>> Your team DOLFIN Core Team is subscribed to branch lp:dolfin. To
> > > >>> unsubscribe from this branch go to
> > > >>> https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscript
> > > >>> io n
> > > >> 
> > > >> _______________________________________________
> > > >> Mailing list: https://launchpad.net/~dolfin
> > > >> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> > > >> Unsubscribe : https://launchpad.net/~dolfin
> > > >> More help   : https://help.launchpad.net/ListHelp
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp
from dolfin import *

parameters["linear_algebra_backend"] = "Epetra"

A = Matrix()

mesh = UnitSquare(2,2)
V = FunctionSpace(mesh, "CG", 1)
u, v = TrialFunction(V), TestFunction(V)

A1 = assemble(u*v*dx)

A.assign(A1)

Follow ups

References