Hi community
I want to perform the operation A .* v, for example
The matrix A is a mass matrix form and b is a logical array of int type which results in a modified A, like
from dolfin import *
mesh = UnitSquareMesh(2,2)
W = FunctionSpace(W)
u = TrialFunction(W)
w = TestFunction(W)
vec = [1 0 1 0 0 0 0 0 0]
b = Function(W)
b.vector().set_local(vec)
# the following is incorrect and will not give me the result that I desire (that is element wise multiplication)
Mb = inner(u,v)*b*dx
Is there a way to do this operation and get the correct modified Mb in ufl form, because the ultimate aim is interact it with other forms.
Conversely,
from dolfin import *
import numpy as np
mesh = UnitSquareMesh(2,2)
W = FunctionSpace(W)
u = TrialFunction(W)
w = TestFunction(W)
b = np.array([1 0 1 0 0 0 0 0 0])
M = assemble(inner(u,v)*dx)
M_arr = M.array()
Mb = M_array * b[:, np.newaxis] # This is the correct Mb
Is there a way to convert Mb to ufl form or make it “interactable” with other forms in Legacy FEniCS?
Thanks!