FunctionAssigner does not always call apply('insert')

Issue #587 resolved
Tormod Landet created an issue

The following code shows the bug

from dolfin import *

mesh = UnitSquareMesh(4, 4)
V = FunctionSpace(mesh, 'CG', 1)
W = MixedFunctionSpace([V, V])

v1 = Function(V)
v2 = Function(V)
w = Function(W)
w.vector()[:] = 1


fa = FunctionAssigner([V, V], W)
fa.assign([v1, v2], w)

print v1.vector()[:].array()

# Removing this line gives PETSc error
v2.vector().apply('insert')

print v2.vector()[:].array()

Comments (7)

  1. Tormod Landet reporter
    • changed status to open

    I can replicate the bug with the following code (updated to make it work with current master), but only when running in parallel. In serial there is no problem.

    from dolfin import *
    
    mesh = UnitSquareMesh(4, 4)
    V = FunctionSpace(mesh, 'CG', 1)
    e = MixedElement([V.ufl_element(), V.ufl_element()])
    W = FunctionSpace(mesh, e)
    
    v1 = Function(V)
    v2 = Function(V)
    w = Function(W)
    w.vector()[:] = 1
    
    
    fa = FunctionAssigner([V, V], W)
    fa.assign([v1, v2], w)
    
    print v1.vector()[:].array()
    
    # Removing this line gives PETSc error
    #v2.vector().apply('insert')
    
    print v2.vector()[:].array()
    

    In parallel I get an error

    *** Error:   Unable to successfully call PETSc function 'VecCopy'.
    *** Reason:  PETSc error code is: 73.
    *** Where:   This error was encountered inside [...]/dolfin/dolfin/la/PETScVector.cpp.
    
  2. Log in to comment