In fenics 2018, I was able to do
A = assemble(...)
A.add(local_tensor, local_to_global_map, local_to_global_map)\
but with fenics 2019 I now get the error “AttributeError: ‘dolfin.cpp.la.Matrix’ object has no attribute ‘add’”
Here is the full example:
from __future__ import division
import numpy as np
import logging
from dolfin import (
FunctionSpace,
TestFunction,
TrialFunction,
assemble,
assemble_local,
cells,
dx,
grad,
inner,
UnitSquareMesh
)
mesh = UnitSquareMesh(8,8)
V = FunctionSpace(mesh, "Lagrange", 1)
u = TrialFunction(V)
v = TestFunction(V)
a = inner(grad(u), grad(v)) * dx
A = assemble(a)
A.zero()
dof_map = V.dofmap()
dof_coord = V.tabulate_dof_coordinates()
for cell in cells(mesh):
local_to_global_map = dof_map.cell_dofs(cell.index())
local_tensor = assemble_local(a, cell)
A.add(local_tensor, local_to_global_map, local_to_global_map)
A.apply("insert")
Thank you for your help.